package com.hqx.oop.inheritance;

public class Student extends Person{
    private long number;
    private int math;
    private int english;
    private int computer;

    public Student(String name, char sex, int age, long number, int math, int english, int computer) {
        super(name, sex, age);
        this.number = number;
        this.math = math;
        this.english = english;
        this.computer = computer;
    }

    public double avg() {
        return (computer+english+math)/3;
    }

    public int max() {
        return (math > english ? math : english) > computer ? (math > english ? math : english) : computer;
    }

    public int min() {
        return (math < english ? math : english) < computer ? (math < english ? math : english) : computer;
    }

    @Override
    public String toString() {
        return "Student{" +
                "number=" + number +
                ", math=" + math +
                ", english=" + english +
                ", computer=" + computer +
                '}';
    }

    public long getNumber() {
        return number;
    }

    public void setNumber(long number) {
        this.number = number;
    }

    public int getMath() {
        return math;
    }

    public void setMath(int math) {
        this.math = math;
    }

    public int getEnglish() {
        return english;
    }

    public void setEnglish(int english) {
        this.english = english;
    }

    public int getComputer() {
        return computer;
    }

    public void setComputer(int computer) {
        this.computer = computer;
    }
}
